package com.example.gifnativedemo;

import android.graphics.Bitmap;

public class GifHandler {
    long gifHandler;

    static {
        System.loadLibrary("native-lib");
    }
    public int getWidth() {
        return getWidth(gifHandler);
    }

    public int getHeight() {
        return getHeight(gifHandler);
    }

    public int updateFrame(Bitmap bitmap) {
        return updateFrame(gifHandler, bitmap);
    }
    public GifHandler(long gifHandler) {
        this.gifHandler = gifHandler;
    }

    public static GifHandler load(String path) {
        long gifhandler = loadGif(path);
        GifHandler gifHandler2 = new GifHandler(gifhandler);
        return gifHandler2;
    }

    //加载图片资源
    public static native int loadGif(String path);

    //获取宽度
    public static native int getWidth(long gifHandler);

    //获高度
    public static native int getHeight(long gifHandler);

    //渲染图片
    public static native int updateFrame(long gifPoint, Bitmap bitmap);
}
